{
  "name" : "testrunner (export) config",

  "include" :
  [
    {
      "path" : "basic.json"
    }
  ],

  "let" :
  {
    "QOOXDOO_PATH" : "../..",
    "TESTRUNNER_ROOT" : ".",
    "TESTRUNNER"   : "testrunner",
    "REPORT_SERVER" : false,
    "TEST_NAMESPACE" : "${APPLICATION}.test",
    "TEST_INCLUDE" : "${TEST_NAMESPACE}.*",
    "TEST_EXCLUDE" : "",
    "TESTS_SCRIPT" : "tests.js",         // output script name
    "BUILD_PATH"   : "build",
    "CACHE"        : "${TMPDIR}/qx${QOOXDOO_VERSION}/cache",
    "THEME"        : "qx.theme.Indigo"
  },

  "config-warnings" :
  {
    "environment" : [ "non-literal-keys" ]
  },

  "jobs" :
  {
    "build" :
    {
      "desc" : "Generates build versions of the Test Runner and the AUT",

      "run" :
      [
        "build-resources",
        "build-files",
        "build-script",
        "build-tests-script",
        "build-tests-resources",
        "build-tests-files"
      ]
    },

    "build-inline" :
    {
      "desc" : "Generates a build version of the Test Runner with integrated test classes",

      "run" :
      [
        "build-resources",
        "build-files",
        "build-inline-script",
        "build-tests-resources",
        "build-tests-files"
      ],

      "copy-files" :
      {
        "files" :
        [
          "index-inline.html",
          "html"
        ],

        "target" : "${BUILD_PATH}",
        "source" : "${TESTRUNNER_ROOT}/source"
      }
    },

    "build-inline-script" :
    {
      "extend" : ["build-script", "tests-common"]
    },

    "build-resources":
    {
      "extend" : ["testrunner-common"],

      "include" :
      [
        "testrunner.*"
      ],

      "copy-resources" :
      {
        "target" : "${BUILD_PATH}"
      }
    },

    "build-files" :
    {
      "extend" : ["testrunner-common"],

      "copy-files" :
      {
        "files" :
        [
          "index.html",
          "html"
        ],

        "target" : "${BUILD_PATH}",
        "source" : "${TESTRUNNER_ROOT}/source"
      }
    },

    "build-script" :
    {
      "desc" : "Generates build version of Test Runner",

      "extend" : ["testrunner-common"],

      "compile-options" :
      {
        "paths" :
        {
          "file" : "${BUILD_PATH}/script/testrunner.js", // this should be relative to 'target'
          "app-root" : "${BUILD_PATH}"
        },
        "code" :
        {
          "optimize" : ["variables", "basecalls", "privates", "strings", "variants", "whitespace"],
          "except"   : []
        },
        "uris"   :
        {
          "script"   : "script",
          "add-nocache-param" : false
        }
      },

      "environment" :
      {
        "testrunner.view" : "${TESTRUNNER_VIEW}",
        "testrunner.testOrigin" : "${TESTRUNNER_ORIGIN}"
      },

      "compile" : { "type" : "build" }
    },

    "source-script" :
    {
      "desc" : "Generates source version of Test Runner",

      "extend" : ["testrunner-common"],

      "compile-options" :
      {
        "paths" :
        {
          "file" : "${TESTRUNNER_ROOT}/source/script/testrunner.js",
          "app-root" : "source"
        },
        "uris" :
        {
          "add-nocache-param" : true
        },
        "code" :
        {
          "locales" : "${LOCALES}",
          "except"  : ["*"]
        }
      },

      "environment" :
      {
        "testrunner.view" : "${TESTRUNNER_VIEW}",
        "testrunner.testOrigin" : "${TESTRUNNER_ORIGIN}"
      },

      "compile" : { "type" : "source" }
    },

    "source-inline-script" :
    {
      "extend" : ["source-script", "tests-common"]
    },

    "testrunner-common" :
    {
      "let" :
      {
        "TESTRUNNER_VIEW" : "testrunner.view.Html",
        "TESTRUNNER_ORIGIN" : "iframe",
        "TESTRUNNER_MAIN_CLASS" : "testrunner.Application"
      },

      "library" :
      [
        {
          "manifest"   : "${QOOXDOO_PATH}/component/library/indigo/Manifest.json"
        },

        {
          "manifest"   : "${QOOXDOO_PATH}/component/library/logpane/Manifest.json"
        },

        {
          "manifest" : "${QOOXDOO_PATH}/component/library/versionlabel/Manifest.json"
        },

        {
          "manifest" : "${QOOXDOO_PATH}/framework/Manifest.json"
        },

        {
          "manifest" : "${TESTRUNNER_ROOT}/Manifest.json"
        }
      ],

      "include" :
      [
        "${TESTRUNNER_MAIN_CLASS}",
        "${TESTRUNNER_VIEW}",
        "${THEME}"
      ],

      "environment" :
      {
        "qx.application"   : "${TESTRUNNER_MAIN_CLASS}",
        "qx.theme"         : "${THEME}",
        "qx.version"       : "${QOOXDOO_VERSION}",
        "qx.revision"      : "${QOOXDOO_REVISION}",
        "qx.testNameSpace" : "${TEST_NAMESPACE}",
        "testrunner.title" : "${APPLICATION}",
        "testrunner.testParts" : false,
        "testrunner.reportServer" : "${REPORT_SERVER}",
        "testrunner.performance" : true
      },

      "cache" :
      {
        "compile"      : "${CACHE}",
        "downloads"    : "${CACHE}/downloads",
        "invalidate-on-tool-change" : true
      }
    },

    "tests-common" :
    {
      "config-warnings" :
      {
        "exclude" : "${TEST_EXCLUDE}"
      },

      "extend"    : [ "common" ],

      "let" :
      {
        "LOCALES" : ["de", "de_DE", "fr", "fr_FR" ]
      },

      "library" :
      [
        {
          "manifest" : "${QOOXDOO_PATH}/framework/Manifest.json"
        },

        {
          "manifest" : "${TESTRUNNER_ROOT}/Manifest.json"
        }
      ],

      "=include" : ["testrunner.TestLoader", "${TEST_INCLUDE}", "${QXTHEME}"],

      "exclude" : ["${TEST_EXCLUDE}"],

      "environment" :
      {
        "qx.theme" : "${QXTHEME}",
        "qx.globalErrorHandling" : true,
        "testrunner.testParts" : false,
        "qx.allowUrlSettings" : true,
        "qx.application" : "testrunner.TestLoader"
      },

      "cache" :
      {
        "compile" : "${CACHE}"
      }
    },

    "build-tests-script" :
    {
      "desc" : "Generates build version of AUT",

      "extend" : ["tests-common"],

      "config-warnings" :
      {
        "environment" : ["variants-and-url-settings"]
      },

      "environment":
      {
        "qx.debug" : false
      },

      "compile-options" :
      {
        "paths" :
        {
          "file" : "${BUILD_PATH}/script/${TESTS_SCRIPT}",
          "app-root" : "${BUILD_PATH}/html"
        },
        "uris" :
        {
           "script"  : "../script",
          "resource" : "../resource"
        },
        "code" :
        {
          "locales"  : "${LOCALES}",
          "optimize" : ["variables", "basecalls", "privates", "strings", "variants", "whitespace"],
          "except"   : [],
          "format"   : true
        }
      },

      "compile" : { "type" : "build" }
    },

    "build-tests-resources" :
    {
      "extend" : ["tests-common"],

      "copy-resources" :
      {
        "target" : "${BUILD_PATH}"
      }
    },


    "build-tests-files" :
    {
      "extend" : ["tests-common"],

      "copy-files" :
      {
        "files" : [],

        "source" : "${ROOT}/source",
        "target" : "${BUILD_PATH}"
      }
    },

    "source" :
    {
      "desc" : "Generates source versions of the Test Runner and the AUT",

      "run" :
      [
        "source-script",
        "source-tests-script"
      ]
    },

    "source-inline" :
    {
      "desc" : "Generates source versions of the Test Runner and the AUT",

      "let" :
      {
        "TESTRUNNER_ORIGIN" : "inline"
      },

      "run" :
      [
        "source-inline-script"
      ]
    },

    "build-with-tests-source" :
    {
      "desc" : "Generates a build version of the Test Runner and a source version of the AUT",

      "run" :
      [
        "build-resources",
        "build-files",
        "build-script",
        "source-tests-script"
      ],

      "copy-files" :
      {
        "files" :
        [
          "index-source.html",
          "html"
        ],

        "target" : "${BUILD_PATH}",
        "source" : "${TESTRUNNER_ROOT}/source"
      }
    },

    "source-tests-script" :
    {
      "desc" : "Generates source version of AUT",

      "extend" : ["tests-common"],

      "compile-options" :
      {
        "paths" :
        {
          "file"     : "${BUILD_PATH}/script/tests-source.js",
          "app-root" : "${BUILD_PATH}/html"
        },

        "code" :
        {
          "locales" : "${LOCALES}",
          "except"  : ["*"]
        }
      },

      "compile" : { "type" : "source" }
    },

    "build-widget" :
    {
      "let" :
      {
        "TESTRUNNER_VIEW" : "testrunner.view.widget.Widget",
        "TESTRUNNER_ORIGIN" : "iframe",
        "TESTRUNNER_MAIN_CLASS" : "testrunner.GuiApplication"
      },

      "run" : [
        "build-widget-resources",
        "build-files",
        "build-script",
        "build-tests-script"
      ],

      "environment" :
      {
        "testrunner.view" : "${TESTRUNNER_VIEW}",
        "testrunner.testOrigin" : "${TESTRUNNER_ORIGIN}"
      }
    },

    "build-widget-resources" :
    {
      "extend" : ["build-resources"],

      "include" :
      [
        "${TESTRUNNER_MAIN_CLASS}",
        "${THEME}",
        "${TESTRUNNER_VIEW}"
      ]
    },

    "source-widget" :
    {
      "let" :
      {
        "TESTRUNNER_VIEW" : "testrunner.view.widget.Widget",
        "TESTRUNNER_ORIGIN" : "iframe",
        "TESTRUNNER_MAIN_CLASS" : "testrunner.GuiApplication"
      },

      "run" : ["source-script",
        "source-tests-script"],

      "environment" :
      {
        "testrunner.view" : "${TESTRUNNER_VIEW}",
        "testrunner.testOrigin" : "${TESTRUNNER_ORIGIN}"
      }
    },

    "build-basic-portable" :
    {
      "extend" : ["build-basic"],

      "=let" :
      {
        "TESTRUNNER_ORIGIN" : "external",
        "TEST_INCLUDE" : ""
      },

      "environment" :
      {
        "testrunner.testOrigin" : "${TESTRUNNER_ORIGIN}"
      },

      "compile-options" :
      {
        "paths" :
        {
          "loader-template" : "${TESTRUNNER_ROOT}/tool/portable.basic.loader.tmpl.js"
        }
      },

      "=library" :
      [
        {
          "manifest" : "${TESTRUNNER_ROOT}/Manifest.json"
        },
        {
          "manifest" : "${QOOXDOO_PATH}/framework/Manifest.json"
        }
      ]
    },

    "mobile-common" :
    {
      "let" :
      {
        "TESTRUNNER_ORIGIN" : "iframe",
        "TESTRUNNER_VIEW" : "testrunner.view.mobile.Mobile",
        "TESTRUNNER_MAIN_CLASS" : "testrunner.MobileApplication",
        "PLATFORM": "ios",
        "TESTRUNNER_CSS" : "testrunner/view/mobile/css/styles.css"
      },

      "environment" :
      {
        "qx.mobile.emulatetouch" : true
      },

      "asset-let" : {
        "qx.mobile.platform" : [ "${PLATFORM}" ]
      }
    },

    "source-mobile" :
    {
      "extend" : ["mobile-common"],

      "run" : [
        "source-mobile-script",
        "source-tests-script"
      ]
    },

    "source-mobile-script" :
    {
      "extend" : ["source-script"],

      "add-css" : [
        {
          "uri" : "../${QOOXDOO_PATH}/framework/source/resource/qx/mobile/css/indigo.css"
        },
        {
          "uri" : "./resource/${TESTRUNNER_CSS}"
        }
      ]
    },

    "build-mobile-script" :
    {
      "extend" : ["build-script"],

      "add-css" : [
        {
          "uri" : "./resource/qx/mobile/css/indigo.css"
        },
        {
          "uri" : "./resource/${TESTRUNNER_CSS}"
        }
      ]
    },

    "build-mobile-resources" :
    {
      "extend" : ["build-resources"],

      "=include" :
      [
        "${TESTRUNNER_MAIN_CLASS}",
        "${TESTRUNNER_VIEW}"
      ]
    },

    "build-mobile" :
    {
      "extend" : ["mobile-common"],

      "run" :
      [
        "build-mobile-resources",
        "build-files",
        "build-mobile-script",
        "build-tests-script",
        "build-tests-resources",
        "build-tests-files"
      ]
    },

    "build-mobile-with-tests-source" :
    {
      "desc" : "Generates a build version of the Test Runner and a source version of the AUT",

      "extend" : ["mobile-common"],

      "run" :
      [
        "build-mobile-resources",
        "build-files",
        "build-mobile-script",
        "source-tests-script"
      ],

      "copy-files" :
      {
        "files" :
        [
          "index-source.html",
          "html"
        ],

        "target" : "${BUILD_PATH}",
        "source" : "${TESTRUNNER_ROOT}/source"
      }
    },

  }
}
